package com.example.crossborderecommerce.mapper;

import com.example.crossborderecommerce.entity.Admin;
import com.example.crossborderecommerce.entity.Store;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.crossborderecommerce.entity.StoreCommodity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Yolanda
 * @since 2024-05-09
 */
@Mapper
public interface StoreMapper extends BaseMapper<Store> {
    public List<Admin> findAdminsInStore();
    public StoreCommodity findStoreCommodityByStoreId(String storeId);
    public StoreCommodity findStoreCommodityByStoreType(String type);
    @Select("SELECT type,IFNULL(COUNT(*),0) AS storeCount " +
            "FROM store " +
            "GROUP BY type;")
    public List<Map<String, Integer>> getStoreCountByType();
}
